<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Insert title here</title>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/jquery-easyui-1.3.3/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/jquery-easyui-1.3.3/themes/icon.css">
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/jquery-easyui-1.3.3/jquery.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/jquery-easyui-1.3.3/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/jquery-easyui-1.3.3/locale/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript">
        $(function () {
           $.post("${pageContext.request.contextPath}/leave/getLeaveByTaskId.do",{taskId:'${param.taskId}'},function (result) {
               var leave = result.leave;
               $("#leavePerson").val(leave.user.firstName+leave.user.lastName);
               $("#leaveDays").val(leave.leaveDays);
               $("#leaveReason").val(leave.leaveReason);
           },"json");
        });
        
        
        function submit(state) {
            $("#fm").form("submit",{
                url:'${pageContext.request.contextPath}/task/audit_ld.do?state='+state,
                onSubmit:function () {
                    return $(this).form("validate");
                },
                success:function (result) {
                    var result = eval('('+result+')');
                    if (result.success){
                        $.messager.alert("系统信息","提交成功");
                    }else{
                        $.messager.alert("系统信息","提交失败");
                        return;
                    }
                }
            });
            
        }
        
        
    </script>

</head>
<body style="margin: 5px">
<div id="p" class="easyui-panel" title="领导审批" style="width: 700px;height: 280px;padding: 10px">
    <form id="fm" method="post">
        <table cellspacing="8px">
            <tr>
                <td>请假人</td>
                <td>
                    <input type="text" id="leavePerson" name="leavePerson" readonly="readonly"/>
                </td>
                <td>&nbsp;</td>
                <td>请假天数</td>
                <td>
                    <input type="text" id="leaveDays" name="leaveDays" readonly="readonly"/>
                </td>
            </tr>
            <tr>
                <td>请假原因</td>
                <td>
                    <input type="text" id="leaveReason" name="leaveReason" readonly="readonly"/>
                </td>
                <td>&nbsp;</td>
                <td>批注</td>
                <td>
                    <input type="text" id="comment" name="comment" />
                </td>
            </tr>
            <tr>
                <td>
                    <input type="hidden" name="taskId" value="${param.taskId}"/>
                </td>
                <td colspan="4">
                    <a href="javascript:submit(1)" class="easyui-linkbutton" iconCls="icon-ok" >批准</a>&nbsp;&nbsp;
                    <a href="javascript:submit(2)" class="easyui-linkbutton" iconCls="icon-no" >驳回</a>
                </td>
            </tr>

        </table>

    </form>
</div>
<div style="padding-top: 5px">
    <table id="dg" title="批注列表" class="easyui-datagrid" fitColumns="true"
           url="${pageContext.request.contextPath}/task/listHistoryComment.do?taskId=${param.taskId}"
           style="width: 700px; height: 200px">
        <thead>
            <tr>
                <th field="time" width="120" align="center">批注时间</th>
                <th field="userId" width="100" align="center">批注人</th>
                <th field="message" width="200" align="center">批注信息</th>
            </tr>
        </thead>
    </table>

</div>

</body>
</html>
